package srw;

import java.util.Vector;

/**
 * 
 * presents which properties the child of some word in the result tree should have
 * 
 */
public class Argument {

	/**
	 * accepts any word
	 */
	public static Argument UNIVERSAL_ARGUMENT = new Argument();
	
	/**
	 * list of argument's properties
	 */
	private Vector<Property> _properties = new Vector<Property>();
	
	/**
	 * constructor
	 */
	public Argument() {
	}
	
	/**
	 * adds property to the argument's list
	 * @param property {@link Property} object
	 */
	public void addProperty(Property property) {
		_properties.add(property);
	}
	
	/**
	 * check if argument's list of properties accepts given properties
	 * @param properties list of given propierties
	 * @return <code>true</code> if argument's list of properties contains all given properties
	 * or conains derived from given properies 
	 */
	public boolean accepts(Vector<Property> properties) {
		for (Property property : _properties) {
			boolean found = false;
			for (Property p : properties) {
				if (p.isDerived(property)) {
					found = true;
					break;
				}
			}
			if (!found)
				return false;
		} 
			
		return true;
	}
	
	/**
	 * just print
	 */
	public void print() {
		for (Property property : _properties) {
			System.err.println(property.getName());
		}
	}

}
